.\" Copyright (c) 2018 Jeff Epler
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
.\" USA.
.TH funct "3rtapi" "" "LinuxCNC Documentation" "RTAPI"
.SH NAME

rtapi_strlcpy \- RTAPI string manipulation functions

.SH SYNTAX
.HP
#include <rtapi_string.h>
.HP
size_t rtapi_strlcpy(char *dst, const char *src, size_t sz);
#define rtapi_strxcpy(dst, src) ...
size_t rtapi_strlcat(char *dst, const char *src, size_t sz);
#define rtapi_strxcat(dst, src) ...

.SH DESCRIPTION
rtapi_strlcpy will copy at most 'sz' chars from 'src' to 'dst'.
Always leaves 'dst' NUL-terminated except if sz is 0.

rtapi_strxcpy(dst, src) checks that dst is an array with known size,
and calls rtapi_strlcpy(dst, src, sizeof(dst)).  If it is not an array
with a known size, it is a (possibly cryptic!) syntax error.

rtapi_strlcat will append characters from 'src' to 'dst', stopping when
the end of 'src' is reached, or 'dst' uses 'sz' bytes of storage including the trialing nul.

rtapi_strxcat(dst, src) checks that dst is an array with known size,
and calls rtapi_strlcat(dst, src, sizeof(dst)).  If it is not an array
with a known size, it is a (possibly cryptic!) syntax error.

.SH RETURN VALUE
The total length of the string strlcpy or strlcat tried to create.
For strlcpy() that means the length of src.  If the return value is
greater than or equal to sz, the result was truncated.
.SH SEE ALSO
strlcpy(3bsd), strlcat(3bsd)
